﻿<%@ Page Language="C#" MasterPageFile="~/YUIAspNet.Master" AutoEventWireup="true" CodeBehind="ClientSide.aspx.cs" Inherits="YUIAspNetDemo.SimpleDialog.ClientSide" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>YUIAspNet Controls : LiveDemo : SimpleDialog : Client side</title>
    
    <script type="text/javascript">
        function ShowDeleteDialog()
        {
            $find("<%=dialog.ClientID  %>").show();
        }
        
        function ModifyDialog()
        {
            var dlg = $find("<%=dialog.ClientID  %>");
            
            dlg.setHeader('my custom header');
            dlg.setBody('my custom body');
            dlg.setFooter('my custom footer');
            
            //close button is gone, so let's show the x
            dlg.get_YUIControl().cfg.setProperty("close", true);
            
            dlg.show();
        }
        
        function Cancel(sender, args)
        {
            sender.hide();
            alert('cancelled');
        }
        
        function Delete(sender, args)
        {
            sender.hide();
            alert('deleted');
        }
        
    </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h1>SimpleDialog client side</h1>
    
    <p>YUIAsp.Net SimpleDialog exposes client functionality to show/hide and change title, content and footer.</p>
    
    <p><a href="#" onclick="ShowDeleteDialog(); return false;">Click here to delete...</a></p>
    
    <p>You can modify the content of the SimpleDialog control on the client.</p>
    <p>In this case there is one thing to consider: your custom content will replace the original content.</p>
    <p><a href="#" onclick="ModifyDialog(); return false;">Click here to open modified dialog</a></p>
    
    <yui:SimpleDialog ID="dialog" runat="server" Underlay="Shadow" Draggable="true" Icon="Alarm" Header="Confirm" Width="400px" Centered="true">
        <Effect Duration="0.3" Effect="Slide" />
        <TextTemplate>Are you sure you want to delete something?</TextTemplate>
        <DialogButtonList>
            <yui:DialogButton Text="OK" Handler="Delete" />
            <yui:DialogButton Text="Cancel" Handler="Cancel" />
        </DialogButtonList>
    </yui:SimpleDialog>
    
</asp:Content>
